Skip to content

Align subtree definition with latest specs - #254

Merged
phbnf merged 5 commits into
transparency-dev:mainfrom
phbnf:newspecs
Jul 23, 2026
Merged

Align subtree definition with latest specs#254
phbnf merged 5 commits into
transparency-dev:mainfrom
phbnf:newspecs

Conversation

@phbnf

@phbnf phbnf commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Updates subtree consistency proof generation, verification, and test vectors to align with recent changes in ietf-plants-wg/merkle-tree-certs:

Specifically:

  • Empty subtrees: start == end is now treated as a valid 0-length subtree. Subtree consistency proofs for empty subtrees return an empty array and verify that the subtree root equals the empty tree hash (HASH()), without depending on the parent tree's root.
  • FindSubtrees edge case: Intervals of size <= 1 now return two subtrees ([start, end) and [end, end)) instead of one. It now returns two subtrees instead of returning an array.
  • Tests & Probes: Updated test loops to include empty subtrees (start == end), updated reference vectors to match the new rolling SHA-256 digests, and added empty subtree test cases to proofgen. Take this as an opportunity to define staticSubtreeConsistencyProbes and invalidSubtreeConsistencyProof statically, rather than dynamically from consistency proof equivalents.

Towards #225

@phbnf
phbnf requested a review from AlCutter July 23, 2026 11:04
@phbnf
phbnf requested a review from a team as a code owner July 23, 2026 11:04
@phbnf phbnf changed the title Newspecs Align subtree definition with latest specs Jul 23, 2026
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 21.73913% with 72 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.57%. Comparing base (28ae4d0) to head (0585192).

Files with missing lines Patch % Lines
cmd/proofgen/main.go 0.00% 60 Missing ⚠️
proof/verify.go 37.50% 9 Missing and 1 partial ⚠️
testonly/tree.go 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #254      +/-   ##
==========================================
- Coverage   48.01%   46.57%   -1.45%     
==========================================
  Files           8        8              
  Lines         933      977      +44     
==========================================
+ Hits          448      455       +7     
- Misses        476      511      +35     
- Partials        9       11       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

phbnf added 4 commits July 23, 2026 11:10
Replace the wrapper around invalidConsistencyProof with a dedicated
invalidSubtreeConsistencyProof function in cmd/proofgen/main.go.

TAG=agy
CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
Update FindSubtrees in proof/proof.go to return two Subtree structs
by value instead of allocating a []Subtree slice.

TAG=agy
CONV=1f76bf92-7d8b-43a5-942a-a4bd88025626
Comment thread proof/proof.go Outdated
func FindSubtrees(start, end uint64) ([]Subtree, error) {
if start >= end {
return nil, fmt.Errorf("start %d must be strictly less than end %d", start, end)
func FindSubtrees(start, end uint64) (Subtree, Subtree, error) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we now always return two subtrees, and those subtrees are guaranteed to be touching, we should ditch the Subtree struct and just return start, mid, end.

This makes it impossible to return non-adjacent ranges, and gets rid of the asymmetry where we return a struct representing subtrees here, but don't take the same subtree struct as an argument anywhere else.

@phbnf
phbnf merged commit 4ebbb84 into transparency-dev:main Jul 23, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants